from app import ma
from app.models import User, ServiceCategory, ServiceProvider, Service, Rating, Carousel

class UserSchema(ma.SQLAlchemySchema):
    class Meta:
        model = User
    
    id = ma.auto_field()
    username = ma.auto_field()
    email = ma.auto_field()
    is_admin = ma.auto_field()
    created_at = ma.auto_field()

class ServiceCategorySchema(ma.SQLAlchemySchema):
    class Meta:
        model = ServiceCategory
    
    id = ma.auto_field()
    name = ma.auto_field()
    description = ma.auto_field()
    created_at = ma.auto_field()

class ServiceProviderSchema(ma.SQLAlchemySchema):
    class Meta:
        model = ServiceProvider
    
    id = ma.auto_field()
    name = ma.auto_field()
    description = ma.auto_field()
    category_id = ma.auto_field()
    created_at = ma.auto_field()

class ServiceSchema(ma.SQLAlchemySchema):
    class Meta:
        model = Service
    
    id = ma.auto_field()
    title = ma.auto_field()
    description = ma.auto_field()
    provider_id = ma.auto_field()
    category_id = ma.auto_field()
    image_url = ma.auto_field()
    video_url = ma.auto_field()
    audio_url = ma.auto_field()
    created_at = ma.auto_field()

class RatingSchema(ma.SQLAlchemySchema):
    class Meta:
        model = Rating
    
    id = ma.auto_field()
    provider_id = ma.auto_field()
    user_id = ma.auto_field()
    rating = ma.auto_field()
    comment = ma.auto_field()
    created_at = ma.auto_field()

class CarouselSchema(ma.SQLAlchemySchema):
    class Meta:
        model = Carousel
    
    id = ma.auto_field()
    image_url = ma.auto_field()
    link = ma.auto_field()
    created_at = ma.auto_field() 